package com.kafka.learn.kafka;

import org.springframework.boot.ConfigurableBootstrapContext;
import org.springframework.boot.SpringApplicationRunListener;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.stereotype.Component;

/**
 * @author 郭辉
 * @className CallBack
 * @description 生命周期
 * @date 2022/1/17 15:46
 * @company 海康威视
 */
public class LifeCycleCallBack implements SpringApplicationRunListener {

    public LifeCycleCallBack(){
        System.out.println("-------------------构造器-------------------");
    }

    @Override
    public void environmentPrepared(ConfigurableBootstrapContext bootstrapContext, ConfigurableEnvironment environment) {
        System.out.println("-------------------environmentPrepared-------------------");
    }

    @Override
    public void contextPrepared(ConfigurableApplicationContext context) {
        System.out.println("-------------------contextPrepared-------------------");
    }

    @Override
    public void contextLoaded(ConfigurableApplicationContext context) {
        System.out.println("-------------------contextLoaded-------------------");
    }

    @Override
    public void started(ConfigurableApplicationContext context) {
        System.out.println("-------------------started-------------------");
    }

    @Override
    public void running(ConfigurableApplicationContext context) {
        System.out.println("-------------------running-------------------");
    }

    @Override
    public void failed(ConfigurableApplicationContext context, Throwable exception) {
        System.out.println("-------------------failed-------------------");
    }
}
